﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UmlControlLibrary;

namespace UmlControlLibrary
{
    /// <summary>
    /// Interaction logic for UmlInterfaceControl.xaml
    /// </summary>
    public partial class UmlInterfaceControl : UmlDesignerElement
    {
        public static void RegisterControl()
        {
            SpecificMenu menu = SpecificMenu.GetTypeMenu(typeof(UmlDiagramControl));
            menu.AddItem(new SpecificMenuItem("Add interface", "Add", AddInterface));
        }

        public UmlInterfaceControl()
            : base()
        {           
            InitializeComponent();
            SetGradientStart("#FFFCEBFF"); 
            SetGradientEnd("#FFF3AFFF");
        }

        public override void AddSections()
        {
            base.AddSections();
            AddSection("Methods", "Methods", "MethodListView", null);
        }

        public static void AddInterface(object sender, RoutedEventArgs e)
        {
            ContextMenuEventArgs args = ((sender as Control).Tag as UmlContextMenu).MenuEventArgs;
            UmlDiagramControl diagram = (sender as MenuItem).DataContext as UmlDiagramControl;
            UmlInterface _interface = new UmlInterface("New_Interface");
            diagram.InsertionPos = new Point(args.CursorLeft, args.CursorTop);
            UmlModel.CurrentDiagram.AddElement(_interface);
        
        }

    }
}
